﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Downloads.aspx.cs" Inherits="gamexpert.member.Downloads" Theme="Black" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <h2>Downloads</h2>
   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="Black" 
        GridLines="Vertical" Width="600px" CssClass="downloadtbl">
       <RowStyle BackColor="#F7F7DE" />
       <Columns>
           <asp:BoundField DataField="title" HeaderText="Game Title" 
               SortExpression="title" />
           <asp:TemplateField HeaderText="Download Link" SortExpression="download">
               <ItemTemplate>
                   <asp:LinkButton ID="LinkButton1" runat="server" CommandName="download" 
                       CommandArgument='<%# Bind("download") %>' Text='<%# Bind("download") %>' 
                       onclick="LinkButton1_Click"></asp:LinkButton>
               </ItemTemplate>
               <EditItemTemplate>
                   <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("download") %>'></asp:TextBox>
               </EditItemTemplate>
           </asp:TemplateField>
       </Columns>
       <FooterStyle BackColor="#CCCC99" />
       <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
       <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
       <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
       <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:gamexpertConnectionString %>" 
        
        SelectCommand="SELECT p.id,p.title, p.download FROM my_orderproduct AS op INNER JOIN my_product AS p ON op.productid = p.id WHERE (p.category = 'Games') AND (op.orderid IN (SELECT id FROM my_order AS o WHERE (userid = @userid)))">
        <SelectParameters>
            <asp:SessionParameter Name="userid" SessionField="userid4download" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:LinkButton ID="LinkButton4" runat="server"  CssClass="rightback" onclick="LinkButton4_Click" 
                 >Back to My Account</asp:LinkButton>
</asp:Content>
